import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

if __name__ == '__main__':
    url = "http://www.baidu.com"

    executable_path = "../drivers/chromedriver.exe"

    service = Service(executable_path=executable_path)
    browser = webdriver.Chrome(service=service)

    browser.get(url=url)
    # 睡眠 10 秒，然后继续

    # 窗口最大化
    browser.maximize_window()
    # 窗口最小化
    # browser.minimize_window()
    time.sleep(10)

    # 保存屏幕截图
    browser.save_screenshot("百度首页.png")
    browser.quit()